<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>原生子应用</title>
  </head>
  <body>
    <!-- 需要通过 http-server 启动页面，端口设置为 7003，允许跨域 -->
    <!-- 或者通过 vscode live-server 插件启动页面 -->
    <!-- 这里写好了：通过 npm run dev 启动（http-server --port 7003 --cors） -->
    <div id="vanilla-root"></div>

    <script>
      const root = document.getElementById("vanilla-root");

      // 导出最终接入协议即可
      window["sub-vanilla"] = {
        bootstrap: async () => {
          // console.log("vanilla app bootstrap");
        },
        mount: async () => {
          // console.log("vanilla app mount");
          root.innerHTML = "<h1>vanilla app</h1>";
        },
        unmount: async () => {
          // console.log("vanilla app unmount");
          root.innerHTML = "";
        },
      };

      if (!window.__POWERED_BY_QIANKUN__) {
        root.innerHTML = "<h1>vanilla app</h1>";
      }
    </script>
  </body>
</html>
